home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Adobe Air 1.5 / AdobeAIRInstaller.exe / setup.swf / scripts / mx / binding / BindingManager.as < prev    next >
Text File  |  2008-10-29  |  3KB  |  92 lines

  1. package mx.binding
  2. {
  3.    import mx.core.mx_internal;
  4.    
  5.    use namespace mx_internal;
  6.    
  7.    public class BindingManager
  8.    {
  9.       
  10.       static var debugDestinationStrings:Object = {};
  11.       
  12.       mx_internal static const VERSION:String = "3.0.0.0";
  13.        
  14.       
  15.       public function BindingManager()
  16.       {
  17.          super();
  18.       }
  19.       
  20.       public static function executeBindings(param1:Object, param2:String, param3:Object) : void
  21.       {
  22.          var _loc4_:* = null;
  23.          if(!param2 || param2 == "")
  24.          {
  25.             return;
  26.          }
  27.          if(param1 && (param1 is IBindingClient || param1.hasOwnProperty("_bindingsByDestination")) && param1._bindingsByDestination && param1._bindingsBeginWithWord[getFirstWord(param2)])
  28.          {
  29.             for(_loc4_ in param1._bindingsByDestination)
  30.             {
  31.                if(_loc4_.charAt(0) == param2.charAt(0))
  32.                {
  33.                   if(_loc4_.indexOf(param2 + ".") == 0 || _loc4_.indexOf(param2 + "[") == 0 || _loc4_ == param2)
  34.                   {
  35.                      param1._bindingsByDestination[_loc4_].execute(param3);
  36.                   }
  37.                }
  38.             }
  39.          }
  40.       }
  41.       
  42.       public static function addBinding(param1:Object, param2:String, param3:Binding) : void
  43.       {
  44.          if(!param1._bindingsByDestination)
  45.          {
  46.             param1._bindingsByDestination = {};
  47.             param1._bindingsBeginWithWord = {};
  48.          }
  49.          param1._bindingsByDestination[param2] = param3;
  50.          param1._bindingsBeginWithWord[getFirstWord(param2)] = true;
  51.       }
  52.       
  53.       public static function debugBinding(param1:String) : void
  54.       {
  55.          debugDestinationStrings[param1] = true;
  56.       }
  57.       
  58.       private static function getFirstWord(param1:String) : String
  59.       {
  60.          var _loc2_:int = param1.indexOf(".");
  61.          var _loc3_:int = param1.indexOf("[");
  62.          if(_loc2_ == _loc3_)
  63.          {
  64.             return param1;
  65.          }
  66.          var _loc4_:int;
  67.          if((_loc4_ = Math.min(_loc2_,_loc3_)) == -1)
  68.          {
  69.             _loc4_ = Math.max(_loc2_,_loc3_);
  70.          }
  71.          return param1.substr(0,_loc4_);
  72.       }
  73.       
  74.       public static function setEnabled(param1:Object, param2:Boolean) : void
  75.       {
  76.          var _loc3_:Array = null;
  77.          var _loc4_:uint = 0;
  78.          var _loc5_:Binding = null;
  79.          if(param1 is IBindingClient && param1._bindings)
  80.          {
  81.             _loc3_ = param1._bindings as Array;
  82.             _loc4_ = 0;
  83.             while(_loc4_ < _loc3_.length)
  84.             {
  85.                (_loc5_ = _loc3_[_loc4_]).isEnabled = param2;
  86.                _loc4_++;
  87.             }
  88.          }
  89.       }
  90.    }
  91. }
  92.